# 多态：同一条指令，不同的对象，产生的行为不一样（不一样的射手射击效果不同）
class Dog:
    def __init__(self, name):
        self.name = name

    def game(self):
        print('%s蹦蹦跳跳的玩耍' %self.name)


class XiaoTianQuan(Dog):
    def game(self):
        print('%s飞到天上去玩耍' %self.name)


class Person():
    def __init__(self, name):
        self.name = name

    def game_with_dog(self,dog:Dog):
        print('%s和%s快乐的玩耍...' %(self.name, dog.name))
        dog.game() #多态

if __name__ == '__main__':
    zhangsan = Person('张三')
    wangcai = Dog('旺财')
    zhangsan.game_with_dog(wangcai)
    xiaotianquan = XiaoTianQuan('哮天犬')
    zhangsan.game_with_dog(xiaotianquan)
